import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { CouponService } from './coupon.service';
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { QueryCouponDetailDto, QueryCouponDto } from './dto/query-coupon.dto';
import { CreateCouponDto } from './dto/create-coupon.dto';

@Controller('coupon')
@ApiTags('优惠券模块')
export class CouponController {
  constructor(private readonly couponService: CouponService) {}

  @Get()
  @ApiOperation({ summary: '查询优惠券' })
  async Query(@Query() params: QueryCouponDto) {
    return await this.couponService.Query(params.userId);
  }

  @Get('detail')
  @ApiOperation({ summary: '查询优惠券详情' })
  async Detail(@Query() params: QueryCouponDetailDto) {
    return await this.couponService.Detail(params.id);
  }

  @Post('add')
  @ApiOperation({ summary: '添加优惠券' })
  async Add(@Body() params: CreateCouponDto) {
    return await this.couponService.Add(params);
  }


}
